$(function () {
	$(".banner").tab();
	/*编辑我的信息*/
	var toggle1=true,
		toggle2=true,
		toggle3=true,
		toggle4=true,
		toggle5=true,
		toggle6=true,
		toggle7=true,
		toggle8=true,
		toggle9=true,
		toggle10=true,
		myclick=true,
		myindex=1;
	$(".toggle1").on("click",function(){
		if(toggle1){
			$(".edit1").trigger("click");
			toggle1=false;
		}else {
			$("#close1").trigger("click");
			toggle1=true;
		}
	})
	$(".toggle2").on("click",function(){
		if(toggle2){
			$(".edit2").trigger("click");
			toggle2=false;
		}else {
			$("#close2").trigger("click");
			toggle2=true;
		}
	})
	$(".toggle3").on("click",function(){
		if(toggle3){
			$(".edit3").trigger("click");
			toggle3=false;
		}else {
			$("#close3").trigger("click");
			toggle3=true;
		}
	})
	$(".toggle4").on("click",function(){
		if(toggle4){
			$(".edit4").trigger("click");
			toggle4=false;
		}else {
			$("#close4").trigger("click");
			toggle4=true;
		}
	})
	$(".toggle5").on("click",function(){
		if(toggle5){
			$(".edit5").trigger("click");
			toggle5=false;
		}else {
			$("#close5").trigger("click");
			toggle5=true;
		}
	})
	$(".toggle6").on("click",function(){
		if(toggle6){
			$(".edit6").trigger("click");
			toggle6=false;
		}else {
			$("#close6").trigger("click");
			toggle6=true;
		}
	})
	$(".toggle8").on("click",function(){
		if(toggle8){
			$(".edit8").trigger("click");
			toggle8=false;
		}else {
			$("#close7").trigger("click");
			toggle8=true;
		}
	})
	$(".toggle9").on("click",function(){
		if(toggle7){
			$(".edit9").trigger("click");
			toggle7=false;
		}else {
			$("#close8").trigger("click");
			toggle7=true;
		}
	})
	$(".toggle10").on("click",function(){
		if(toggle9){
			$(".edit10").trigger("click");
			toggle9=false;
		}else {
			$("#close9").trigger("click");
			toggle9=true;
		}
	})
	$(".toggle11").on("click",function(){
		if(toggle10){
			$(".edit11").trigger("click");
			toggle10=false;
		}else {
			$("#close11").trigger("click");
			toggle10=true;
		}
	})
	var myfun=function(){
			var num=0;
			for(var i=0,len=$(".message").length;i<len;i++){
				if($(".message").eq(i).val()===""){
					num++
				}
			}
			if($("#labels").html()==""){
				num++
			}
			if(num==11){
				$("#progress").html("0%").css("width","0");
			}else if(num==10){
				$("#progress").html("9.1%").css("width","9%");
			}else if(num==9){
				$("#progress").html("18.2%").css("width","18%");
			}else if(num==8){
				$("#progress").html("27.3%").css("width","27%");
			}else if(num==7){
				$("#progress").html("36.4%").css("width","36%");
			}else if(num==6){
				$("#progress").html("45.5%").css("width","45%");
			}else if(num==5){
				$("#progress").html("54.6%").css("width","54%");
			}else if(num==4){
				$("#progress").html("63.7%").css("width","63%");
			}else if(num==3){
				$("#progress").html("72.8%").css("width","72%");
			}else if(num==2){
				$("#progress").html("81.9%").css("width","81%");
			}else if(num==1){
				$("#progress").html("91%").css("width","90%");
			}else if(num==0){
				$("#progress").html("100%").css("width","100%");
			}
		},

		/*填写昵称*/

		fun1=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowpetname=$("#petname").val();
			$(this).parent().css({"height":226}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="petname">昵称</label><p>前昵称：<span id="nowpetname"></span></p><p>新昵称：<input type="text" id="newpetname" placeholder="请输入您的新昵称，2~10位" maxlength="10"></p><a href="javascript:void(0)" id="keep1" class="keep">保存</a><a href="javascript:void(0)" id="close1" class="close">关闭</a>');
			$("#nowpetname").html(nowpetname);
			$("#keep1").on("click",fun2);
			$("#close1").on("click",fun3);
			myindex=1;
			$("#newpetname").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun2=function(event){
			if(!$("#newpetname").val()==""){
				var newpetname=$("#newpetname").val();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="petname">昵称</label><input type="text" id="petname" name="petname" readonly class="message"><a href="javascript:void(0)" class="edit edit1">编辑</a>');
				$("#petname").val(newpetname);
				$(".edit1").on("click",fun1);
				myfun();
			}else {
				alert("请先输入新昵称再保存")
			};
			event.stopPropagation();
			
		},
		fun3=function(){
			myindex=0;
			nowpetname=$("#nowpetname").html();
			if(!$("#newpetname").val()==""){
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="petname">昵称</label><input type="text" id="petname" name="petname" readonly class="message"><a href="javascript:void(0)" class="edit edit1">编辑</a>');
				$(".edit1").on("click",fun1);
				$("#petname").val(nowpetname);
			}else {
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="petname">昵称</label><input type="text" id="petname" name="petname" readonly class="message"><a href="javascript:void(0)" class="edit edit1">编辑</a>');
				$(".edit1").on("click",fun1);
				$("#petname").val(nowpetname);
			};
		},

		/*填写艺名*/

		fun4=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowstagename=$("#stagename").val();
			$(this).parent().css({"height":226}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="stagename">艺名</label><p>前艺名：<span id="nowstagename"></span></p><p>现艺名：<input type="text" id="newstagename" placeholder="请输入您的新艺名，2~10位" maxlength="10"></p><a href="javascript:void(0)" id="keep2" class="keep">保存</a><a href="javascript:void(0)" id="close2" class="close">关闭</a>');
			$("#nowstagename").html(nowstagename);
			$("#keep2").on("click",fun5);
			$("#close2").on("click",fun6);
			// console.log($(this).parent());
			myindex=2;
			$("#newstagename").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun5=function(event){
			if(!$("#newstagename").val()==""){
				var newstagename=$("#newstagename").val();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="stagename">艺名</label><input type="text" id="stagename" name="stagename" readonly class="message"><a href="javascript:void(0)" class="edit edit2">编辑</a>');
				$("#stagename").val(newstagename);
				$(".edit2").on("click",fun4);
				myfun();
			}else {
				alert("请先输入新艺名再保存")
			}
			event.stopPropagation();
			
		},
		fun6=function(){
			myindex=0;
			nowstagename=$("#nowstagename").html();
			if(!$("#newstagename").val()==""){
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="stagename">艺名</label><input type="text" id="stagename" name="stagename" readonly class="message"><a href="javascript:void(0)" class="edit edit2">编辑</a>');
				$(".edit2").on("click",fun4);
				$("#stagename").val(nowstagename);
			}else {
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="stagename">艺名</label><input type="text" id="stagename" name="stagename" readonly class="message"><a href="javascript:void(0)" class="edit edit2">编辑</a>');
				$(".edit2").on("click",fun4);
				$("#stagename").val(nowstagename);
			}
		},

		/*选择或自定义职业*/

		fun7=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowjob=$("#job").val();
			$(this).parent().css({"height":226}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="job">职业</label><p>前职业：<span id="nowjob"></span></p><p>现职业：<select id="job_select"><option value="模特" selected>模特</option><option value="演员">演员</option><option value="网红">网红</option><option value="主持">主持</option><option value="歌手">歌手</option><option value="自定义">自定义</option></select><input type="text" id="newjob" maxlength="6"></p><a href="javascript:void(0)" id="keep3" class="keep">保存</a><a href="javascript:void(0)" id="close3" class="close">关闭</a>');
			$("#nowjob").html(nowjob);
			$("#keep3").on("click",fun8);
			$("#close3").on("click",fun9);
			$("#job_select").on("change",function(){
				if($(this).val()==="自定义"){
					$("#newjob").css("display","inline-block");
				}else {
					$("#newjob").css("display","none");
				}
			})
			myindex=3;
			$("#job_select").on("click",function(event){
				event.stopPropagation();
				
			})
			$("#newjob").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun8=function(event){
			if(!($("#job_select").val()=="自定义")){
				newjob=$("#job_select").val();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="job">职业</label><input type="text" id="job" name="job" readonly class="message"><a href="javascript:void(0)" class="edit edit3">编辑</a>');
			}else if($("#newjob").val()===""){
				alert("请先输入自定义新职业再保存");
			}else {
				newjob=$("#newjob").val();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="job">职业</label><input type="text" id="job" name="job" readonly class="message"><a href="javascript:void(0)" class="edit edit3">编辑</a>');
			}
			$("#job").val(newjob);
			$(".edit3").on("click",fun7);
			myfun();
			event.stopPropagation();
			
		},
		fun9=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="job">职业</label><input type="text" id="job" name="job" readonly class="message"><a href="javascript:void(0)" class="edit edit3">编辑</a>');
			$(".edit3").on("click",fun7);
			$("#job").val(nowjob);
		},

		/*标签选择和填写设置*/

		fun10=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowlabel=$("#labels").html();
			$(this).parent().css({"height":256}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="label">标签</label><p>现标签：<span id="contain_nowlabel"></span></p><div id="contain_div">新标签：<div id="contain_newlabel"><input maxlength="6" type="text" id="writenewlabel" placeholder="填入或选择你的新标签"></div></div><div id="select_newlabel"><span class="select_newlabel_span">车模</span><span class="select_newlabel_span">型男</span><span class="select_newlabel_span">外籍</span><span class="select_newlabel_span">化妆师</span><span class="select_newlabel_span">男模特</span><span class="select_newlabel_span">高贵型</span><span class="select_newlabel_span">cosplay</span></div><a href="javascript:void(0)" id="keep4" class="keep">保存</a><a href="javascript:void(0)" id="close4" class="close">取消</a>');
			$("#contain_newlabel").html($("#hide").html()+'<input maxlength="6" type="text" id="writenewlabel" placeholder="填入或选择你的新标签">')
			$("#contain_newlabel").on("click",function(event){
				event.stopPropagation();
				
			})
			$(".close_newlabel").on("click",function(event){
				$(this).parent().remove();
				$("#writenewlabel")[0].readOnly=false;
				event.stopPropagation();
				
			});
			$("#contain_nowlabel").html(nowlabel);
			$("#keep4").on("click",fun11);
			$("#close4").on("click",fun12);
			$(".select_newlabel_span").on("click",select_newlabel);
			$("#writenewlabel").on("keydown",write_newlabel);
			$("#writenewlabel").on("click",function(event){
				event.stopPropagation();
				
			})
			myindex=4;
		},
		fun11=function(){
			if($("#contain_newlabel").children().length>1){
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$("#contain_newlabel").children().eq($("#contain_newlabel").children().length-1).remove();
				$("#hide").html($("#contain_newlabel").html());
				if($("#contain_newlabel").children().length>3){
					$(this).parent().html('<div class="zhanwei"></div><label for="label">标签</label><div id="labels"></div><a href="javascript:void(0)" class="edit edit4">编辑</a>');
					var children1=$("#hide").children().eq(0).clone();
					var children2=$("#hide").children().eq(1).clone();
					var children3=$("#hide").children().eq(2).clone();
					$("#labels").append(children1,children2,children3);
					$("#labels").html($("#labels").html()+"等"+$("#hide").children().length+"个标签");
					$("#labels").find(".close_newlabel").remove();
					$(".edit4").on("click",fun10);
					myfun();
				}else{
					var childrenN=$("#contain_newlabel").html();
					$(this).parent().html('<div class="zhanwei"></div><label for="label">标签</label><div id="labels"></div><a href="javascript:void(0)" class="edit edit4">编辑</a>');
					$("#labels").html(childrenN);
					$("#labels").find(".close_newlabel").remove();
					$(".edit4").on("click",fun10);
					myfun();
				}
			}else {
				alert("请先输入新标签再保存");
			}
		},
		fun12=function(){
			myindex=0;
			if($("#contain_newlabel").children().length>1){
				var childrenN=$("#contain_nowlabel").html();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="label">标签</label><div id="labels"></div><a href="javascript:void(0)" class="edit edit4">编辑</a>');
				$(".edit4").on("click",fun10);
				$("#labels").html(childrenN);
			}else {
				var childrenN=$("#contain_nowlabel").html();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="label">标签</label><div id="labels"></div><a href="javascript:void(0)" class="edit edit4">编辑</a>');
				$(".edit4").on("click",fun10);
				$("#labels").html(childrenN);
			}
		},

		/*填写标签*/

		write_newlabel=function(event){
			if($("#contain_newlabel").children().length>10){
				$("#writenewlabel").val("");
				$("#writenewlabel")[0].readOnly=true;
				return false;
			}
			var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
			if(keyCode==32||keyCode==13){ // 按下空格或回车
				if(!($(this).val()=="")){
					var newspan=document.createElement("span");
					newspan.innerHTML=$(this).val();
					$("#contain_newlabel").prepend(newspan);
					$(this).val("");
					var close=document.createElement("a");
					close.innerHTML="x";
					close.classList.add("close_newlabel");
					$(newspan).prepend(close);
					$(close).on("click",function(){
						$(this).parent().remove();
						$("#writenewlabel")[0].readOnly=false;
					});
				}
			}
		},

		/*选择标签*/

		select_newlabel=function(event){
			if($("#contain_newlabel").children().length>10){
				$("#writenewlabel").val("");
				$("#writenewlabel")[0].readOnly=true;
				alert("最多可以添加十个标签，请慎重选择！")
				return false;
			}
			var newspan=document.createElement("span");
			newspan.innerHTML=$(this).html();
			$("#contain_newlabel").prepend(newspan);
			$(this).remove();
			var close=document.createElement("a");
			close.innerHTML="x";
			close.classList.add("close_newlabel");
			$(newspan).prepend(close);
			$(close).on("click",function(event){
				$(this).parent().remove();
				$("#writenewlabel")[0].readOnly=false;
				event.stopPropagation();
				
			});
			event.stopPropagation();
			
		},

		/*情感状态设置*/

		fun13=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowemotion=$("#emotion").val();
			$(this).parent().css({"height":226}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="emotion">情感</label><p>前状态：<span id="nowemotion"></span></p><p>现状态：<select id="emotion_select"><option value="单身" selected>单身</option><option value="热恋">热恋</option><option value="已婚">已婚</option></select></p><a href="javascript:void(0)" id="keep5" class="keep">保存</a><a href="javascript:void(0)" id="close5" class="close">关闭</a>');
			$("#nowemotion").html(nowemotion);
			$("#keep5").on("click",fun14);
			$("#close5").on("click",fun15);
			myindex=5;
			$("#emotion_select").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun14=function(event){
			newemotion=$("#emotion_select").val();
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
			$(this).parent().html('<div class="zhanwei"></div><label for="emotion">情感</label><input type="text" id="emotion" name="emotion" readonly class="message"><a href="javascript:void(0)" class="edit edit5">编辑</a>');
			$("#emotion").val(newemotion);
			$(".edit5").on("click",fun13);
			myfun();
			event.stopPropagation();
			
		},
		fun15=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="emotion">情感</label><input type="text" id="emotion" name="emotion" readonly class="message"><a href="javascript:void(0)" class="edit edit5">编辑</a>');
			$(".edit5").on("click",fun13);
			$("#emotion").val(nowemotion);
		},

		/*生日及星座设置*/

		fun16=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowbirthday=$("#birthday").val();
			$(this).parent().css({"height":226}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="emotion">生日</label><p>前生日：<span id="nowbirthday"></span></p><p>改生日：<input type="text" name="datepicker" id="datetimepicker" class="form-control" value="1988-8-8"></p><a href="javascript:void(0)" id="keep6" class="keep">保存</a><a href="javascript:void(0)" id="close6" class="close">关闭</a>');
			$("#nowbirthday").html(nowbirthday);
			$("#datetimepicker").on("click",funSetTime);
			$("#keep6").on("click",fun17);
			$("#close6").on("click",fun18);
			myindex=6;
			$("#datetimepicker").on("click",function(event){
				event.stopPropagation();
			})
		},
		fun17=function(event){
			newbirthday=$("#datetimepicker").val();
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
			$(this).parent().html('<div class="zhanwei"></div><label for="birthday">生日</label><input type="text" id="birthday" name="birthday" readonly class="message"><a href="javascript:void(0)" class="edit edit6">编辑</a>');
			$("#birthday").val(newbirthday);
			$(".edit6").on("click",fun16);
			constellation_select();
			myfun();
			event.stopPropagation();
			
		},
		fun18=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="birthday">生日</label><input type="text" id="birthday" name="birthday" readonly class="message"><a href="javascript:void(0)" class="edit edit6">编辑</a>');
			$(".edit6").on("click",fun16);
			$("#birthday").val(nowbirthday);
		},
		funSetTime=function(e){
			e.stopPropagation();
			$(this).lqdatetimepicker({
				css : 'datetime-day',
				dateType : 'D',
				selectback : function(){
				}
			});
		},
		constellation_select=function(){
			var mybirthday=newbirthday.split("-"),
				mouth=mybirthday[1],
				day=mybirthday[2],
				constellation="";
			if(mouth==12){
				if(day>21){
					constellation="摩羯座";
				}else{
					constellation="射手座";
				}
			}else if(mouth==11){
				if(day>22){
					constellation="射手座";
				}else{
					constellation="天蝎座";
				}
			}else if(mouth==10){
				if(day>23){
					constellation="天蝎座";
				}else{
					constellation="天秤座";
				}
			}else if(mouth==9){
				if(day>22){
					constellation="天秤座";
				}else{
					constellation="处女座";
				}
			}else if(mouth==8){
				if(day>22){
					constellation="处女座";
				}else{
					constellation="狮子座";
				}
			}else if(mouth==7){
				if(day>22){
					constellation="狮子座";
				}else{
					constellation="巨蟹座";
				}
			}else if(mouth==6){
				if(day>21){
					constellation="巨蟹座";
				}else{
					constellation="双子座";
				}
			}else if(mouth==5){
				if(day>20){
					constellation="双子座";
				}else{
					constellation="金牛座";
				}
			}else if(mouth==4){
				if(day>19){
					constellation="金牛座";
				}else{
					constellation="白羊座";
				}
			}else if(mouth==3){
				if(day>20){
					constellation="白羊座";
				}else{
					constellation="双鱼座";
				}
			}else if(mouth==2){
				if(day>18){
					constellation="双鱼座";
				}else{
					constellation="水瓶座";
				}
			}else{
				if(day>19){
					constellation="水瓶座";
				}else{
					constellation="射手座";
				}
			}
			$("#constellation").val(constellation);
		},

		/*教育信息*/

		fun19=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowteach=$("#teach").val();
			$(this).parent().css({"height":166}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="teach">教育信息</label><p>更新院校：<input type="text" id="newteach" placeholder="请填入您的学校名称"></p><a href="javascript:void(0)" id="keep9" class="keep">保存</a><a href="javascript:void(0)" id="close9" class="close">关闭</a>');
			$("#keep9").on("click",fun20);
			$("#close9").on("click",fun21);
			$("#newteach").autocomplete({source: availableTags});
			$("#newteach")[0].focus();
			myindex=9;
			$("#newteach").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun20=function(event){
			if($("#newteach").val()==""){
				alert("请先输入您的院校再保存");
			}else {
				newteach=$("#newteach").val();
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="teach">教育信息</label><input type="text" id="teach" name="teach" readonly class="message"><a href="javascript:void(0)" class="edit edit10">编辑</a>');
				$("#teach").val(newteach);
				$(".edit10").on("click",fun19);
				myfun();
			}
			event.stopPropagation();
			
		},
		fun21=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="teach">教育信息</label><input type="text" id="teach" name="teach" readonly class="message"><a href="javascript:void(0)" class="edit edit10">编辑</a>');
			$(".edit10").on("click",fun19);
			$("#teach").val(nowteach);
		},
		availableTags = [
			"安徽科技大学",
			"安徽财经大学",
			"浙江大学",
			"浙江电子科技大学",
			"浙江工商大学",
			"北京大学",
			"北京农学院",
			"北京工业大学",
			"上海大学",
			"上海理工大学",
			"上海交通大学",
			"上海商学院",
			"南京大学",
			"南京农业大学",
			"南京理工大学",
			"杭州大学",
			"杭州电子科技大学",
			"杭州师范大学"
		],

		/*语言信息*/

		fun22=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			nowlanguage=$("#language").val();
			$(this).parent().css({"height":166}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="language">语言设置</label><p>语言选择：<input type="checkbox" value="普通话" name="newlanguage" class="newlanguage">普通话<input type="checkbox" value="台湾话" name="newlanguage" class="newlanguage">台湾话<input name="newlanguage" type="checkbox" value="粤语" class="newlanguage">粤语<input name="newlanguage" type="checkbox" value="English" class="newlanguage">English<input name="newlanguage" type="checkbox" value="日语" class="newlanguage">日语<input name="newlanguage" type="checkbox" value="韩语" class="newlanguage">韩语<input name="newlanguage" type="checkbox" value="法语" class="newlanguage">法语<input type="checkbox" value="俄语" name="newlanguage" class="newlanguage">俄语<input type="checkbox" value="德语" name="newlanguage" class="newlanguage">德语</p><a href="javascript:void(0)" id="keep7" class="keep">保存</a><a href="javascript:void(0)" id="close7" class="close">关闭</a>');
			$("#keep7").on("click",fun23);
			$("#close7").on("click",fun24);
			myindex=7;
			$("#newpetname").on("click",function(event){
				event.stopPropagation();
				
			})
			$(".toggle8").find("input").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun23=function(event){
			if($('input:checkbox[name=newlanguage]:checked').length==0){
				alert("请先设置您的语言再保存");
			}else {
				var newlanguage = "";
				$('input:checkbox[name=newlanguage]:checked').each(function(i){
					if(0==i){
						newlanguage = $(this).val();
					}else{
						newlanguage += (","+$(this).val());
					}
				});
				$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
				$(this).parent().html('<div class="zhanwei"></div><label for="language">语言</label><input type="text" id="language" name="language" readonly class="message"><a href="javascript:void(0)" class="edit edit8">编辑</a>');
				$("#language").val(newlanguage);
				$(".edit8").on("click",fun22);
				myfun();
			}
			event.stopPropagation();
			
		},
		fun24=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="language">语言</label><input type="text" id="language" name="language" readonly class="message"><a href="javascript:void(0)" class="edit edit8">编辑</a>');
			$(".edit8").on("click",fun22);
			$("#language").val(nowlanguage);
		},
		fun25=function(){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			$(this).css("display","none");
			home=$("#home").val();
			$(this).parent().css({"height":166}).addClass("white").removeClass("f2f2f2");
			$(this).parent().html('<div class="zhanwei"></div><label for="language">家乡</label><p>省市选择：<select id="country"><option value="中国">中国</option></select><select id="province"></select><select id="city"></select></p><a href="javascript:void(0)" id="keep11" class="keep">保存</a><a href="javascript:void(0)" id="close11" class="close">关闭</a>');
			$("#keep11").on("click",fun26);
			$("#close11").on("click",fun27);
			init();
			$("#province").on("change",getCity);
			myindex=11;
			$("#country").on("click",function(event){
				event.stopPropagation();
				
			})
			$("#province").on("click",function(event){
				event.stopPropagation();
				
			})
			$("#city").on("click",function(event){
				event.stopPropagation();
				
			})
		},
		fun26=function(event){
			var newhome = $("#country").val()+"-"+$("#province").val()+"-"+$("#city").val();
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
			$(this).parent().html('<div class="zhanwei"></div><label for="home">家乡</label><input type="text" id="home" name="home" readonly class="message"><a href="javascript:void(0)" class="edit edit11">编辑</a>');
			$("#home").val(newhome);
			$(".edit11").on("click",fun25);
			myfun();
			event.stopPropagation();
			
		},
		fun27=function(){
			myindex=0;
			$(this).parent().css({"height":44}).addClass("f2f2f2").removeClass("white");
	 		$(this).parent().html('<div class="zhanwei"></div><label for="home">家乡</label><input type="text" id="home" name="home" readonly class="message"><a href="javascript:void(0)" class="edit edit11">编辑</a>');
			$(".edit11").on("click",fun25);
			$("#home").val(home);
		},
		fun28=function(event){
			if(myindex){
				$("#"+"close"+myindex).trigger("click");
			}
			nownation=$("#nation").val();
			$(this).parent().css({"height":176}).addClass("white").removeClass("f2f2f2");
        	$(this).parent().html('<div class="zhanwei"></div><label for="nation">民族</label><div id="displaywillnone"><div>民族选择：<div  id="all_nation"><input type="text" name="nation" placeholder="请选择您的民族" id="select_nation"><div id="contain_nation"><a href="javascript:void(0)" class="specific_nation">汉族</a><a href="javascript:void(0)" class="specific_nation">壮族</a><a href="javascript:void(0)" class="specific_nation">满族</a><a href="javascript:void(0)" class="specific_nation">回族</a><a href="javascript:void(0)" class="specific_nation">苗族</a><a href="javascript:void(0)" class="specific_nation">维吾尔族</a><a href="javascript:void(0)" class="specific_nation">土家族</a><a href="javascript:void(0)" class="specific_nation">彝族</a><a href="javascript:void(0)" class="specific_nation">蒙古族</a><a href="javascript:void(0)" class="specific_nation">藏族</a><a href="javascript:void(0)" class="specific_nation">布依族</a><a href="javascript:void(0)" class="specific_nation">侗族</a><a href="javascript:void(0)" class="specific_nation">瑶族</a><br><a href="javascript:void(0)" class="specific_nation">朝鲜族</a><a href="javascript:void(0)" class="specific_nation">白族</a><a href="javascript:void(0)" class="specific_nation">哈尼族</a><a href="javascript:void(0)" class="specific_nation">哈萨克族</a><a href="javascript:void(0)" class="specific_nation">黎族</a><a href="javascript:void(0)" class="specific_nation">傣族</a><a href="javascript:void(0)" class="specific_nation">畲族</a><a href="javascript:void(0)" class="specific_nation">傈僳族</a><a href="javascript:void(0)" class="specific_nation">仡佬族</a><a href="javascript:void(0)" class="specific_nation">东乡族</a><a href="javascript:void(0)" class="specific_nation">高山族</a><a href="javascript:void(0)" class="specific_nation">拉祜族</a><br><a href="javascript:void(0)" class="specific_nation">水族</a><a href="javascript:void(0)" class="specific_nation">佤族</a><a href="javascript:void(0)" class="specific_nation">纳西族</a><a href="javascript:void(0)" class="specific_nation">羌族</a><a href="javascript:void(0)" class="specific_nation">土族</a><a href="javascript:void(0)" class="specific_nation">仫佬族</a><a href="javascript:void(0)" class="specific_nation">锡伯族</a><a href="javascript:void(0)" class="specific_nation">柯尔克孜族</a><a href="javascript:void(0)" class="specific_nation">达斡尔族</a><a href="javascript:void(0)" class="specific_nation">景颇族</a><a href="javascript:void(0)" class="specific_nation">毛南族</a><a href="javascript:void(0)" class="specific_nation">京族</a><br><a href="javascript:void(0)" class="specific_nation">撒拉族</a><a href="javascript:void(0)" class="specific_nation">塔吉克族</a><a href="javascript:void(0)" class="specific_nation">阿昌族</a><a href="javascript:void(0)" class="specific_nation">普米族</a><a href="javascript:void(0)" class="specific_nation">鄂温克族</a><a href="javascript:void(0)" class="specific_nation">怒族</a><a href="javascript:void(0)" class="specific_nation">基诺族</a><a href="javascript:void(0)" class="specific_nation">德昂族</a><a href="javascript:void(0)" class="specific_nation">保安族</a><a href="javascript:void(0)" class="specific_nation">俄罗斯族</a><br><a href="javascript:void(0)" class="specific_nation">裕固族</a><a href="javascript:void(0)" class="specific_nation">乌兹别克族</a><a href="javascript:void(0)" class="specific_nation">门巴族</a><a href="javascript:void(0)" class="specific_nation">鄂伦春族</a><a href="javascript:void(0)" class="specific_nation">独龙族</a><a href="javascript:void(0)" class="specific_nation">塔塔尔族</a><a href="javascript:void(0)" class="specific_nation">赫哲族</a><a href="javascript:void(0)" class="specific_nation">珞巴族</a><a href="javascript:void(0)" class="specific_nation">布朗族</a><br><a href="javascript:void(0)" id="foreign">国外友人请直接填写</a></div></div></div><a href="javascript:void(0)" id="keep8" class="keep">保存</a><a href="javascript:void(0)" id="close8" class="close">关闭</a></div>')
			$("#keep8").on("click",fun29);
			$("#close8").on("click",fun30);
			myindex=8;
			$("#all_nation").on("click",function(event){
		        $("#contain_nation").css("display","block");
		        event.stopPropagation();
		        
		    })
		    $("#foreign").on("click",function(event){
		    	$(this).parent().css("display","none");
		    	$("#select_nation").val("");
		    	$("#select_nation")[0].focus();
		    	event.stopPropagation();
		        
		    })
		    $(".specific_nation").on("click",function(event){
		        $(this).parent().css("display","none");
				$("#select_nation").val(this.innerHTML);
				event.stopPropagation();
		        
			})
			$(window).on("click",function(){
		    	$("#contain_nation").css("display","none");
		    })
		    event.stopPropagation();
			
		},
		fun30=function(event){
	    	myindex=0;
	        $(".toggle9").css({"height":44}).addClass("f2f2f2").removeClass("white");
	        $(".toggle9").html('<div class="zhanwei"></div><label for="nation">民族</label><input type="text" id="nation" name="nation" readonly class="message" maxlength="6"><a href="javascript:void(0)" class="edit edit9">编辑</a> ')
	        $("#nation").val(nownation);
	        $(".edit9").on("click",fun28);
	        event.stopPropagation();
	        
	    },
		fun29=function(event){
	        myindex=0;
	        newnation=$("#select_nation").val();
	        $(".toggle9").css({"height":44}).addClass("f2f2f2").removeClass("white");
	        $(".toggle9").html('<div class="zhanwei"></div><label for="nation">民族</label><input type="text" id="nation" name="nation" readonly class="message" maxlength="6"><a href="javascript:void(0)" class="edit edit9">编辑</a> ')
	        if(newnation){
	        	$("#nation").val(newnation)
	        }else {
	        	$("#nation").val(nownation)
	        };
	        $(".edit9").on("click",fun28);
	        myfun();
	        event.stopPropagation();
	        
	    };
	var oProvince=["北京","上海","天津","重庆","河北","山西","内蒙古","辽宁","吉林","黑龙江","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","四川","贵州","云南","西藏","陕西","甘肃","宁夏","青海","新疆","香港","澳门","台湾"];
    var arr = new  Array();
    arr[0]="东城,西城,崇文,宣武,朝阳,丰台,石景山,海淀,门头沟,房山,通州,顺义,昌平,大兴,平谷,怀柔,密云,延庆" 
    arr[1]="黄浦,卢湾,徐汇,长宁,静安,普陀,闸北,虹口,杨浦,闵行,宝山,嘉定,浦东,金山,松江,青浦,南汇,奉贤,崇明" 
    arr[2]="和平,东丽,河东,西青,河西,津南,南开,北辰,河北,武清,红挢,塘沽,汉沽,大港,宁河,静海,宝坻,蓟县" 
    arr[3]="万州,涪陵,渝中,大渡口,江北,沙坪坝,九龙坡,南岸,北碚,万盛,双挢,渝北,巴南,黔江,长寿,綦江,潼南,铜梁,大足,荣昌,壁山,梁平,城口,丰都,垫江,武隆,忠县,开县,云阳,奉节,巫山,巫溪,石柱,秀山,酉阳,彭水,江津,合川,永川,南川" 
    arr[4]="石家庄,邯郸,邢台,保定,张家口,承德,廊坊,唐山,秦皇岛,沧州,衡水" 
    arr[5]="太原,大同,阳泉,长治,晋城,朔州,吕梁,忻州,晋中,临汾,运城" 
    arr[6]="呼和浩特,包头,乌海,赤峰,呼伦贝尔盟,阿拉善盟,哲里木盟,兴安盟,乌兰察布盟,锡林郭勒盟,巴彦淖尔盟,伊克昭盟" 
    arr[7]="沈阳,大连,鞍山,抚顺,本溪,丹东,锦州,营口,阜新,辽阳,盘锦,铁岭,朝阳,葫芦岛" 
    arr[8]="长春,吉林,四平,辽源,通化,白山,松原,白城,延边" 
    arr[9]="哈尔滨,齐齐哈尔,牡丹江,佳木斯,大庆,绥化,鹤岗,鸡西,黑河,双鸭山,伊春,七台河,大兴安岭" 
    arr[10]="南京,镇江,苏州,南通,扬州,盐城,徐州,连云港,常州,无锡,宿迁,泰州,淮安" 
    arr[11]="杭州,宁波,温州,嘉兴,湖州,绍兴,金华,衢州,舟山,台州,丽水" 
    arr[12]="合肥,芜湖,蚌埠,马鞍山,淮北,铜陵,安庆,黄山,滁州,宿州,池州,淮南,巢湖,阜阳,六安,宣城,亳州" 
    arr[13]="福州,厦门,莆田,三明,泉州,漳州,南平,龙岩,宁德" 
    arr[14]="南昌市,景德镇,九江,鹰潭,萍乡,新馀,赣州,吉安,宜春,抚州,上饶" 
    arr[15]="济南,青岛,淄博,枣庄,东营,烟台,潍坊,济宁,泰安,威海,日照,莱芜,临沂,德州,聊城,滨州,菏泽" 
    arr[16]="郑州,开封,洛阳,平顶山,安阳,鹤壁,新乡,焦作,濮阳,许昌,漯河,三门峡,南阳,商丘,信阳,周口,驻马店,济源" 
    arr[17]="武汉,宜昌,荆州,襄樊,黄石,荆门,黄冈,十堰,恩施,潜江,天门,仙桃,随州,咸宁,孝感,鄂州" 
    arr[18]="长沙,常德,株洲,湘潭,衡阳,岳阳,邵阳,益阳,娄底,怀化,郴州,永州,湘西,张家界" 
    arr[19]="广州,深圳,珠海,汕头,东莞,中山,佛山,韶关,江门,湛江,茂名,肇庆,惠州,梅州,汕尾,河源,阳江,清远,潮州,揭阳,云浮" 
    arr[20]="南宁,柳州,桂林,梧州,北海,防城港,钦州,贵港,玉林,南宁地区,柳州地区,贺州,百色,河池" 
    arr[21]="海口,三亚" 
    arr[22]="成都,绵阳,德阳,自贡,攀枝花,广元,内江,乐山,南充,宜宾,广安,达川,雅安,眉山,甘孜,凉山,泸州" 
    arr[23]="贵阳,六盘水,遵义,安顺,铜仁,黔西南,毕节,黔东南,黔南" 
    arr[24]="昆明,大理,曲靖,玉溪,昭通,楚雄,红河,文山,思茅,西双版纳,保山,德宏,丽江,怒江,迪庆,临沧" 
    arr[25]="拉萨,日喀则,山南,林芝,昌都,阿里,那曲" 
    arr[26]="西安,宝鸡,咸阳,铜川,渭南,延安,榆林,汉中,安康,商洛" 
    arr[27]="兰州,嘉峪关,金昌,白银,天水,酒泉,张掖,武威,定西,陇南,平凉,庆阳,临夏,甘南" 
    arr[28]="银川,石嘴山,吴忠,固原" 
    arr[29]="西宁,海东,海南,海北,黄南,玉树,果洛,海西" 
    arr[30]="乌鲁木齐,石河子,克拉玛依,伊犁,巴音郭勒,昌吉,克孜勒苏柯尔克孜,博 尔塔拉,吐鲁番,哈密,喀什,和田,阿克苏" 
    arr[31]="香港" 
    arr[32]="澳门" 
    arr[33]="台北,高雄,台中,台南,屏东,南投,云林,新竹,彰化,苗栗,嘉义,花莲,桃园,宜兰,基隆,台东,金门,马祖,澎湖" 
    function init()
    {   
        var pro = document.getElementById("province");
        var city = document.getElementById("city");
        var cityArr = arr[0].split(",");
        for(var j=0;j<oProvince.length;j++){
            pro[j]=new Option(oProvince[j],oProvince[j]);
        }
        for(var i=0;i<cityArr.length;i++)
        {
            city[i]=new Option(cityArr[i],cityArr[i]);
        }
    }

    function getCity(){    
        var pro = document.getElementById("province");
        var index = pro.selectedIndex;
        var cityArr = arr[index].split(",");   
        console.log(index)
        city.length = 0;
        //将城市数组中的值填充到城市下拉框中
        for(var i=0;i<cityArr.length;i++)
        {
            city[i]=new Option(cityArr[i],cityArr[i]);
        }
    }
	$("#keep7").on("click",fun23);
	$(".edit1").on("click",fun1);
	$(".edit2").on("click",fun4);
	$(".edit3").on("click",fun7);
	$(".edit4").on("click",fun10);
	$(".edit5").on("click",fun13);
	$(".edit6").on("click",fun16);
	$(".edit8").on("click",fun22);
	$(".edit10").on("click",fun19);
	$(".edit9").on("click",fun28);
	$(".edit11").on("click",fun25);

	/*我的钱包*/

	/*个人资料*/
	$(".personalData").on("click",function(){
		var fun101=function(){
			
		}
	})
})